<?php
//* inherit params
extract($params = array(
	// product one
	'extra_class' => '',
	'show_title' => true,
	'shorten_title' => 0,
	'show_image' => true,
	'image_width' => 110,
	'image_height' => 160,
	'show_numbered' => false,
	'show_author' => true,
	'show_rating' => true,
	'show_price' => true,
	'price_text' => '',
	'show_description' => false,
	'shorten_description' => 500,
	'show_share' => true,
	'show_buttons' => false,
	'show_buy_button' => false,
	'show_lend_button' => false,
	'show_borrow_button' => false,
	'custom_args' => false,
	'user_id' => false,
	//'layout' => array('image', 'details' => 'open', 'title', 'author', 'rating', 'price', 'description', 'share', 'buttons', 'close'),
	'layout' => array('image', 'details' => 'open', 'title', 'author', 'rating', 'description', 'share', 'buttons', 'close'),
), EXTR_SKIP);

extract(array(
	'columns' => 4,
	'class' => 'products-slider',
	'row_class' => 'products-row',
	'grid_class' => 'products-grid-%s',
), EXTR_SKIP);

if ( !empty($products) ) {
	?>
		<?php if(!empty($title)):?>
		<h2 class="block-title link_store">
			<?php 
				if(!empty($title_url)) echo '<a href="'.$title_url.'">'.$title.'</a>'; 
				else echo $title;
			?>
		</h2>
		<?php endif;?>
	<?php
	$row_class .= ' ' . sprintf($grid_class, $columns);

	printf('<div class="%s">', $class);
	
	$count = 0;
	$total = count($products);
	foreach ($products as $product) {
		
		if ( $count == 0 || $count % $columns == 0 ) {
			printf('<div class="%s">', $row_class);
		}
		
		$numbered = $count + 1;
		
		$this->renderPartial('//common/product_one_user', compact('product', 'numbered', array_keys($params)));

		$count++;

		if ( $count == $total || ($count) % $columns == 0 ) {
			printf('</div>');
		}
	}
	
	printf('</div>');
	
}
?>